import React, { useEffect, useState } from 'react'
import axios from '../../api/index'
import { useParams } from 'react-router-dom'
import { NavBar } from 'antd-mobile'
import dayjs from 'dayjs'
import { useNavigate } from 'react-router-dom'
import './index.scss'

function Syxq() {
  const [data, setData] = useState([])
  const { id } = useParams()
  console.log(id)
  const navigate = useNavigate()
  useEffect(() => {
    axios.get('/share/information/v1/findInformation', {
      params: { infoId: id }
    }).then(res => {
      console.log(res);
      setData(res.data.result)
    })
  }, [id])

  return (
    <div className='syxq-top'>
      <NavBar onBack={() => navigate(-1)}>健康咨询</NavBar>
      <div className='top'>
         <span style={{fontSize:'18px'}}>{data.title}</span>
         <div className='info-row'>
           <span className='dl'>{data.source}</span>
           <span className='sj'>{dayjs(data.releaseTime).format('YYYY-MM-DD')}</span>
         </div>
      </div>
      <div dangerouslySetInnerHTML={{__html:data.content}}>
      </div>
    </div>
  )
}

export default Syxq